<?php
/**
 * YErrorHandler.php
 *
 * @author Hua Yang <htmlcook@gmail.com>
 * @since 2.0
 */

/**
 * Class YErrorHandler
 */
class YErrorHandler extends CErrorHandler
{
	public $versionInfo;

	public function init()
	{
		parent::init();
		if (defined('INSTALLED')) {
			$adminEmail = Yii::app()->getOption()->get('site.adminEmail');
			if ($adminEmail) {
				$this->adminInfo = CHtml::mailto($adminEmail, $adminEmail);
			}
		}
	}

	public function getVersionInfo()
	{
		if ($this->versionInfo)
			return $this->versionInfo;

		if(YII_DEBUG) {
			$version = 'CMF/' . YCmf::getVersion();
			$version .= ' Application/' . Yii::app()->version;
			$version .= ' <a href="http://www.yiiframework.com/">Yii Framework</a>/'.Yii::getVersion();
			if(isset($_SERVER['SERVER_SOFTWARE']))
				$version=$_SERVER['SERVER_SOFTWARE'].' '.$version;
		} else {
			$version='';
		}
		return $version;
	}
} 